package com.vrv.app.cyberspace.modules.sys.controller;


import com.vrv.app.cyberspace.common.utils.JSONResult;
import com.vrv.app.cyberspace.common.validator.ValidatorUtils;
import com.vrv.app.cyberspace.modules.sys.entity.BaseTable;
import com.vrv.app.cyberspace.modules.sys.entity.EventTable;
import com.vrv.app.cyberspace.modules.sys.service.IEventTableService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author sm
 * @since 2017-12-15
 */
@Api(description="事件")
@RestController
@RequestMapping("/sys/event")
public class EventTableController extends BaseController {
    @Autowired
    private IEventTableService eventTableService;

    @PostMapping()
    public JSONResult addEvent(BaseTable bt, EventTable et,String infrastructure_information) {
        ValidatorUtils.validateEntity(bt);
        ValidatorUtils.validateEntity(et);
        bt.setCreateUserID(getUserId());
        return eventTableService.addEvent(bt, et,infrastructure_information);
    }

    @PutMapping("/{id}")
    public JSONResult updateEvent(@PathVariable Integer id, BaseTable bt, EventTable et) {
        return eventTableService.updateEvent(id, bt, et);
    }
}

